package com.woniu.controller;

import com.woniu.entity.ChargingStation;
import com.woniu.service.ChargingStationService;
import com.woniu.dto.RealTimeMonitoring.StationChangeDTO;
import com.woniu.dto.RealTimeMonitoring.StationNameSearchRequestDTO;
import com.woniu.dto.RealTimeMonitoring.ChargerInfoRequestDTO;
import com.woniu.dto.RealTimeMonitoring.StationChangeDTO;
import com.woniu.dto.RealTimeMonitoring.StationNameSearchRequestDTO;
import com.woniu.service.ChargingStationService;
import com.woniu.util.PageData;
import com.woniu.util.ResponseData;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/chargingStation")
@AllArgsConstructor
public class ChargingStationController {
    @Resource
    private ChargingStationService chargingStationService;

    @RequestMapping("/getStationInfo")
    public List<ChargingStation> getStationInfo(@RequestParam("stationName") String stationName) {
        List<ChargingStation> stationInfo = chargingStationService.getStationInfo(stationName);
        return stationInfo;
    }


    @GetMapping("/stationNameSearchById")
    public ResponseData<?> stationNameSearchById() {
        System.out.println("1111");
        return ResponseData.ok();
    }

    @PostMapping("/stationNameSearch")
    public ResponseData<?> stationNameSearch(@RequestBody StationNameSearchRequestDTO stationNameSearchDTO) {
        return chargingStationService.stationNameSearch(stationNameSearchDTO.getStationName());
    }

    @PostMapping("/stationChange")
    public ResponseData<?> stationChange(@RequestBody StationChangeDTO stationChangeDTO) {
        return chargingStationService.stationChange(stationChangeDTO);
    }

    @GetMapping("/initMapStation")
    public ResponseData<?> initMapStation() {
        return chargingStationService.initMapStation();
    }


    @PostMapping("/stationNameSearchWx")
    public ResponseData<?> stationNameSearchWx(@RequestBody StationNameSearchRequestDTO stationNameSearchDTO) {
        return chargingStationService.stationNameSearchWx(stationNameSearchDTO.getStationName());
    }

    @PostMapping("/stationNameSearchMap")
    public ResponseData<?> stationNameSearchMap(@RequestBody StationNameSearchRequestDTO stationNameSearchDTO) {
        return chargingStationService.stationNameSearchMap(stationNameSearchDTO.getStationName());
    }

}
